<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    var c = 100;
    function fun1(){
        var a = 200
        console.log(a);//200
        console.log(c);//100
        function fun2(){
            var b = 300
            console.log(a);//200
            console.log(b);//300
            console.log(c);//100
        }
        fun2()
    }
    fun1()
    //就近原则
    //变量的作用域链：一个人函数在访问变量的时候，优先使用自己的局部变量，如果没有，
</script>
</html>